<extend name="Public:base" />
<block name="title">病例详情</block>
<block name="content">
    <webuploadercss />
    <webuploaderjs />
    <div class="page__bd">
        <div class="weui-form-preview__bd center_list_one xian_bottom xinxi_con">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">患者姓名：</label>
                <span class="weui-form-preview__value">{$info['name']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">疾病类型：</label>
                <span class="weui-form-preview__value">{$info['cate']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">所属医院：</label>
                <span class="weui-form-preview__value">{$info['hospital']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">时间：</label>
                <span class="weui-form-preview__value">{$info['addtime']|todate}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">备注：</label>
                <span class="weui-form-preview__value">{$info['remarks']}</span>
            </div>
            <div class="chuo chuo_yizhuanzhen">
                <if condition="$info['statename']">
                {$info['statename']}
                    <else/>
                未转诊
                </if>
            </div>
        </div>
        <form id="ajaxForm">
            <input type="hidden" name="id" id="id" value="{$info['id']}">
            <div class="page__bd">
                <div class="weui-gallery" id="gallery">
                    <span class="weui-gallery__img" id="galleryImg"></span>
                    <div class="weui-gallery__opr">
                        <a href="javascript:" class="weui-gallery__del">
                            <i class="weui-icon-delete weui-icon_gallery-delete"></i>
                        </a>
                    </div>
                </div>
                <div class="weui-cells weui-cells_form">
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <div class="weui-uploader">
                                <div class="weui-uploader__hd">
                                    <p class="weui-uploader__title txt_cen ">病例信息</p>
                                </div>
                                <div class="weui-uploader__bd">
                                    <ul class="weui-uploader__files" id="uploaderFiles">
                                        <if condition="is_array($pic)">
                                            <foreach name="pic" item="list">
                                                <li class="weui-uploader__file" style="background-image:url(__ROOT__{$list})">
                                                    <img src="__ROOT__{$list}" height="100%" width="100%">
                                                </li>
                                            </foreach>
                                            <else/>
                                            <li class="weui-uploader__file" style="background-image:url(__ROOT__{$pic})">
                                                <img src="__ROOT__{$pic}" height="100%" width="100%">
                                            </li>
                                        </if>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="weui-cell tag">
                    <webuploader name="pic" url="{:U('Home/User/ajax_upload')}" word="或将照片拖到这里，单次最多可选300张" />
                </div>
            </div>

            <div class="button-sp-area xinxi_but_area bingli_but_area">
                <a href="__MODULE__/User/patientlist" class="weui-btn weui-btn_mini bingli_but">返回</a>
                <a href="javascript:;" class="weui-btn weui-btn_mini bingli_but" id="mod">修改</a>
                <a href="javascript:;" class="weui-btn weui-btn_mini bingli_but" id="del">删除</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $("#mod").click(function(){
            var formData = $('#ajaxForm').serialize();
            $.ajax({
                type:'post',
                url:'__MODULE__/User/patientmod',
                data:formData,
                cache:false,
                dataType:'json',
                success:function(res){
                    if(res.code == 0){
                        layer.msg(res.msg,function () {
                            window.location.href = res.url;
                        });
                        return false;
                    }else{
                        layer.msg(res.msg);
                        return false;
                    }
                }
            });
        });
        $("#del").click(function(){
            var formData = $('#ajaxForm').serialize();
            $.ajax({
                type:'post',
                url:'__MODULE__/User/patientdel',
                data:formData,
                cache:false,
                dataType:'json',
                success:function(res){
                    if(res.code == 0){
                        layer.msg(res.msg,function () {
                            window.location.href = res.url;
                        });
                        return false;
                    }else{
                        layer.msg(res.msg);
                        return false;
                    }
                }
            });
        });
    </script>
</block>